package com.example.mqdemo.rabbitmq.workquee.consumer;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/*
消息消费方
 */
@Component
public class WorkConsumer {
    @RabbitListener(queues = "work")
    public void consumer1(String msg){
        System.out.println("work消费" + msg );
    }
    @RabbitListener(queues = "work")
    public void consumer3(String msg){
        System.out.println("work消费" + msg+"测试三消费" );
    }

    //消息消费方，监听队列  可以自己配置权重
    @RabbitListener(queues = "work",concurrency = "10")
    public void consumer(String msg){
        System.out.println("work消费" +  msg +"--------"+Thread.currentThread().getName() );
    }
}
